package XynLeen.GraduationProject.Fragments.Bills;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import XynLeen.GraduationProject.R;

public class Fragment_Out extends Fragment implements View.OnClickListener,CompoundButton.OnCheckedChangeListener{

    private RadioGroup gp1;
    private RadioGroup gp2;
    private RadioGroup gp3;
    private RadioButton bt_photo;
    private RadioButton bt_dress;
    private RadioButton bt_suit;
    private RadioButton bt_ring;
    private RadioButton bt_cosmetics;
    private RadioButton bt_tableware;
    private RadioButton bt_tobacco;
    private RadioButton bt_gift;
    private RadioButton bt_field;
    private RadioButton bt_money;
    private RadioButton bt_travel;
    private RadioButton bt_film;
    private RadioButton bt_fleet;
    private RadioButton bt_others;

    public static String curName;
    public static int curImgId;

    @Override
    public View onCreateView(LayoutInflater inflater,
                             @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {

        View view= inflater.inflate(R.layout.fragment_out, container, false);

        gp1=view.findViewById(R.id.group_1);
        gp2=view.findViewById(R.id.group_2);
        gp3=view.findViewById(R.id.group_3);
        bt_photo=view.findViewById(R.id.out_photo);
        bt_dress=view.findViewById(R.id.out_dress);
        bt_suit=view.findViewById(R.id.out_suit);
        bt_ring=view.findViewById(R.id.out_ring);
        bt_cosmetics=view.findViewById(R.id.out_cosmetics);
        bt_tableware=view.findViewById(R.id.out_tableware);
        bt_tobacco=view.findViewById(R.id.out_tobacco);
        bt_gift=view.findViewById(R.id.out_gift);
        bt_field=view.findViewById(R.id.out_field);
        bt_money=view.findViewById(R.id.out_money);
        bt_travel=view.findViewById(R.id.out_travel);
        bt_film=view.findViewById(R.id.out_film);
        bt_fleet=view.findViewById(R.id.out_fleet);
        bt_others=view.findViewById(R.id.out_others);

        bt_photo.setOnCheckedChangeListener(this);
        bt_dress.setOnCheckedChangeListener(this);
        bt_suit.setOnCheckedChangeListener(this);
        bt_ring.setOnCheckedChangeListener(this);
        bt_cosmetics.setOnCheckedChangeListener(this);
        bt_tableware.setOnCheckedChangeListener(this);
        bt_tobacco.setOnCheckedChangeListener(this);
        bt_gift.setOnCheckedChangeListener(this);
        bt_field.setOnCheckedChangeListener(this);
        bt_money.setOnCheckedChangeListener(this);
        bt_travel.setOnCheckedChangeListener(this);
        bt_film.setOnCheckedChangeListener(this);
        bt_fleet.setOnCheckedChangeListener(this);
        bt_others.setOnCheckedChangeListener(this);

        return view;
    }

    @Override
    public void onClick(View v) {

    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        switch (buttonView.getId()){
            case R.id.out_photo:
                curName="结婚照";
                curImgId=R.mipmap.ic_out_photo;
                gp2.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_dress:
                curName="婚纱";
                curImgId=R.mipmap.ic_out_dress;
                gp2.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_suit:
                curName="西装";
                curImgId=R.mipmap.ic_out_suit;
                gp2.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_ring:
                curName="戒指";
                curImgId=R.mipmap.ic_out_ring;
                gp2.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_cosmetics:
                curName="跟妆";
                curImgId=R.mipmap.ic_out_cosmetics;
                gp2.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_tableware:
                curName="婚宴酒席";
                curImgId=R.mipmap.ic_out_tableware;
                gp1.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_tobacco:
                curName="烟酒";
                curImgId=R.mipmap.ic_out_tobacco;
                gp1.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_gift:
                curName="伴手礼";
                curImgId=R.mipmap.ic_out_gift;
                gp1.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_field:
                curName="场地租赁";
                curImgId=R.mipmap.ic_out_field;
                gp1.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_money:
                curName="彩礼";
                curImgId=R.mipmap.ic_out_money;
                gp1.clearCheck();
                gp3.clearCheck();
                break;
            case R.id.out_travel:
                curName="蜜月旅行";
                curImgId=R.mipmap.ic_out_travel;
                gp1.clearCheck();
                gp2.clearCheck();
                break;
            case R.id.out_film:
                curName="摄影摄像";
                curImgId=R.mipmap.ic_out_film;
                gp1.clearCheck();
                gp2.clearCheck();
                break;
            case R.id.out_fleet:
                curName="婚礼车队";
                curImgId=R.mipmap.ic_out_fleet;
                gp1.clearCheck();
                gp2.clearCheck();
                break;
            case R.id.out_others:
                curName="其它";
                curImgId=R.mipmap.ic_out_others;
                gp1.clearCheck();
                gp2.clearCheck();
                break;

        }
    }
}
